package com.bdqn.biz;

import com.bdqn.dao.BaseDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "NewSelect",value = "/NewSelect")
public class NewSelect extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("doget");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("post 方法");
        request.setCharacterEncoding("utf-8");
        String nn=request.getParameter("nn");
        String s1=request.getParameter("s1");
        String id=request.getParameter("id");
        try {
            BaseDao.getResultSet("select a.*,b.name from newtable a inner join newType b on a.ntype=b.id",new Object[]{nn,s1,id});
            response.sendRedirect("/Web1/List.jsp?index=1");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
